package per.hx.bs.config;

import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import per.hx.bs.base.domain.ReturnDTO;

/**
 * @author HuXing
 * @date 2018/5/10  14:13
 */
@RestControllerAdvice
public class WxException {

    @ExceptionHandler(AuthorizeException.class)
    public ReturnDTO authorizeException(AuthorizeException e) {
        e.printStackTrace();
        System.out.println(e.getMessage());
        return ReturnDTO.error(e.getLocalizedMessage());
    }

    @ExceptionHandler(Exception.class)
    public ReturnDTO wxException(Exception e) {
        e.printStackTrace();
        System.out.println(e.getMessage());
        return ReturnDTO.error(e.getLocalizedMessage());
    }
}
